package n09.second;

import java.util.Arrays;

public class N02 {

	public static void main(String[] args) {
		Shape[]shapes=new Shape[] {
			new Circle(10),
			new Circle(20),
			new Rectangle(20,20),
			new Rectangle(10, 8)
		};
		System.out.println("按形状的面积升序排列：");
		Arrays.sort(shapes, Shape.comparatorByArea());
		for (Shape shape : shapes) {
			System.out.println("   "+shape);
		}
		
		System.out.println("按形状的面积降序排列：");
		Arrays.sort(shapes, Shape.comparatorByArea().reversed());
		for (Shape shape : shapes) {
			System.out.println("   "+shape);
		}
	}

}
